<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
$strSQL = "select * from `bet_Lotto` where ID = ".(int)$_data["ID"];
if(!$RS = @PMA_mysql_query($strSQL, $$_Conn)){
	$GLOBALS["errormessage"] = "Find Lotto Data Error!!";
	ErrMsgOutputHTML("Error", "", 1);
}

if(PMA_mysql_num_rows($RS) == 0){
	@mysql_close($$_Conn);
	header("Location: ".basename($_SERVER["PHP_SELF"])."?op=List");
	exit();
}else{
	$objLotto = PMA_mysql_fetch_object($RS);
}


$fp = @file($strTemplatePath."Edit.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);

$fp = str_replace("{intID}", $objLotto -> ID, $fp);
$fp = str_replace("{ShowLType}", $_arrLType[$objLotto -> LType], $fp);
$fp = str_replace("{ShowLotto_3}", $objLotto -> Lotto_3, $fp);
$fp = str_replace("{ShowLotto_1}", $objLotto -> Lotto_1, $fp);
$fp = str_replace("{ShowLotto_2}", $objLotto -> Lotto_2, $fp);
$fp = str_replace("{ShowLottoURL}", $objLotto -> LottoURL, $fp);
$fp = str_replace("{ShowNumber}", $objLotto -> Number, $fp);
$fp = str_replace("{ShowColorSet}", $objLotto -> ColorSet, $fp);
$fp = str_replace("{ShowDrawSpecial}", $objLotto -> DrawSpecial, $fp);
$fp = str_replace("{ShowSpecialOverNumber}", $objLotto -> SpecialOverNumber, $fp);
$fp = str_replace("{ShowNormalOverNumber}", $objLotto -> NormalOverNumber, $fp);

if($objLotto -> ID != 1){
	$fp = preg_replace("/<!-- ThroughOddsGap@bof \/\/-->.+<!-- ThroughOddsGap@eof \/\/-->/s", $strCon, $fp);
}else{
	$arrTOG = explode(",", $objLotto -> ThroughOddsGap);
	foreach($arrTOG as $k => $v){
		$fp = str_replace("{ShowThroughOddsGap".$k."}", (float)$v, $fp);
	}
}

while(list($k, $v) = each($_strLotto)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>